﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Profile;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SQLiteProviderStack
{
    public partial class Account : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                var profile = ProfileBase.Create(Page.User.Identity.Name, true);
                DisplayNameTextBox.Text = (string)profile.GetPropertyValue("DisplayName");
            }
        }

        protected void SaveButton_Click(object sender, EventArgs e)
        {
            var profile = ProfileBase.Create(Page.User.Identity.Name, true);
            profile["DisplayName"]= DisplayNameTextBox.Text;
            profile.Save();
            Response.Redirect(Request.Url.AbsolutePath);

        }
    }
}
